package org.hot100_1;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class leetcode51 {

    List<List<Integer>> res = new ArrayList<>();
    LinkedList<Integer> item = new LinkedList<>();
    public List<List<Integer>> subsets(int[] nums) {
        backtracking(nums,0);
        return res;
    }

    private void backtracking(int [] nums,int startIndex){
        res.add(new ArrayList<>(item));

        for (int i = startIndex; i < nums.length; i++) {
            item.add(nums[i]);
            backtracking(nums,i+1);
            item.removeLast();
        }
    }
}
